﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Galaxy.AutoCAD.Strings;
using Galaxy.AutoCAD.Options;

namespace Galaxy.AutoCAD.Windows
{
    public partial class LaminateBlockWindow : Form
    {
        public LaminateBlockWindow()
        {
            InitializeComponent();
        }

        private void LaminateBlockWindow_Load(object sender, EventArgs e)
        {
            this.textBox1.Focus();
            this.textBox1.Text = "1-";
            this.textBox2.Text = "-F";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (StringTool.IsSafeBlockString(this.textBox1.Text))
            {
                LaminateOptionTool.LaminateBlockPrefix = this.textBox1.Text;
                if (StringTool.IsSafeBlockString(this.textBox2.Text))
                {
                    LaminateOptionTool.LaminateBlockSuffix = this.textBox2.Text;
                    LaminateOptionTool.LaminateBlockPass = "1";
                    this.Close();
                }
                else
                {
                    Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("请输入有效值");
                    this.textBox2.Focus();
                }
            }
            else
            {
                Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog("请输入有效值");
                this.textBox1.Focus();
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            LaminateOptionTool.LaminateBlockPass = "0";
            this.Close();
        }

        private void textBox1_Click(object sender, EventArgs e)
        {
            this.textBox1.SelectAll();
        }

        private void textBox2_Click(object sender, EventArgs e)
        {
            this.textBox2.SelectAll();
        }
    }
}
